package flc.ast.activity;

import android.graphics.Bitmap;

import java.util.List;

import flc.ast.BaseAc;
import flc.ast.R;
import flc.ast.databinding.ActivityRecResultBinding;
import stark.common.apis.base.ImgAnimalRet;
import stark.common.apis.base.ImgPlantRet;
import stark.common.basic.utils.BitmapUtil;

public class RecResultActivity extends BaseAc<ActivityRecResultBinding> {

    public static int type;
    public static Bitmap sBitmap;
    public static List<ImgPlantRet> sPlantRets;
    public static List<ImgAnimalRet> sAnimRets;
    private int MAX_BITMAP_SIZE = 4 * 1024 * 1024;


    @Override
    protected int onCreate() {
        return R.layout.activity_rec_result;
    }

    @Override
    protected void initView() {
        mDataBinding.ivRecResultBack.setOnClickListener(v -> getOnBackPressedDispatcher().onBackPressed());
    }

    @Override
    protected void initData() {
        sBitmap = BitmapUtil.scaleWhenThan(sBitmap, MAX_BITMAP_SIZE, 2000, true);
        mDataBinding.ivImg.setImageBitmap(sBitmap);

        if (type == 0) {
            mDataBinding.tvName.setText(sPlantRets.get(0).name);
            mDataBinding.tvDesc.setText(sPlantRets.get(0).baike_info.description);
        } else {
            mDataBinding.tvName.setText(sAnimRets.get(0).name);
            mDataBinding.tvDesc.setText(sAnimRets.get(0).baike_info.description);
        }
    }

}